<?php
declare (strict_types = 1);

namespace app\admin\model;

use thinkless\common\BaseModel;

/**
 * @Table tl_config
 * @Comment 配置
 * @Column(['name' => 'key', 'type' => 'varchar', 'length' => 50, 'pk' => true ])
 * @Column(['name' => 'value', 'type' => 'varchar', 'length' => 100 ])
 * @Column(['name' => 'desc', 'type' => 'varchar', 'length' => 20 ])
 */
class ConfigModel extends BaseModel {

    public function getValueByKey($key) {
        $res = (new self)->where('key', $key)->find();
        if(empty($res)) return '';
        return $res['value'];
    }
}
